Skip to content

feat(workspace): FIX-1762 local workspace host and scoped projection (1/4) - #2737

Merged
jhoffner merged 5 commits into
mainfrom
claude/project-thread-6n4tdx
Oct 5, 2026
Merged

jhoffner merged 5 commits into
mainfrom
claude/project-thread-6n4tdx

Conversation

@jhoffner

@jhoffner jhoffner commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Jake · project thread

The problem

A coding run gets its files from one repository that the operator sets at boot. A project cannot name its own repository. A project with no repository has no place to keep its files. One project's files must never go into another project's run.

What this does

This is PR 1 of a 4-PR stack for FIX-1762. It adds the shared layer only, in @flow-state-dev/workspace. PRs 3 and 4 stack on it. PR 2 (Workforce) goes off main on its own.

  • Run source (S1). A type. It gets the block context and answers one of: a repository (repo, optional baseRef), a set of kept files (files, projectId), or a refusal with a reason.
  • Scoped mount (S2). A Mount can have a scope. The projection then lists, reads, writes and deletes only the keys under <scope>/. The collection does the filter (list("<scope>/")), so the run does not read other keys.
  • Local workspace host (S3). localWorkspaceHost({ root, remotes: { allow }, source }) gives provision · save · release. checkpoint and restore exist and do nothing (slice 2).
    • Repository: the host checks the remote against the allowlist before it starts any git process. It keeps one bare clone for each remote in <root>/.clones/. Before it cuts a new branch, it fetches and reads the default branch again. It makes the branch in checkout/. If a checkout already exists, the host gives it back with no fetch, reset or rebase.
    • Kept files go in project/ next to checkout/, or in workspace/ when the project has no repository. The host fills them from one key prefix and save writes them back.

What changes

This PR builds the right half of the figure only: the host and the scoped mount. No caller uses it yet. Harness-manager starts to use it in PR 3. The Lab wiring and the goal check come in PR 4.

What's asked of you

Nothing new. This PR implements the approved spec. One small call is listed under Engineering calls: baseRef is optional on a repository answer.

Parts worth reviewing closely

For the code reviewer.

  1. Rebuild of kept files (provisionFiles in local-host.ts). If this process did not fill a project/ or workspace/ directory, for example after a restart, the host clears it and fills it again from the collection. If the host kept those files, a later flush could put back a file that another run deleted. The cost: edits that the run did not save before a crash are lost. This is my weakest call. Slice 2 is where uncommitted work becomes durable.
  2. Remote parsing (remotes.ts). It refuses -…, ext:: and other <x>:: helpers, ssh and scp hosts that start with -, whitespace, passwords, an https login, bare paths, http, git://, and file:// unless "file" is listed. Git also runs with GIT_ALLOW_PROTOCOL set to the listed schemes and -- before the remote.
  3. The clone lock is in-process only. A queue for each clone stops two runs in one process from making two clones. Between processes, the clone is made in a temporary directory and then renamed, so a second process sees no clone or a whole clone. Two processes can both make a clone, and one is then thrown away.

Fixes nothing alone. Part of FIX-1762 · spec: specs/issues/FIX-1762/ on main · spec PR #2723 · goal check: none in this PR (it runs in PR 4, goals/devforce-lab/it-codes-in-the-projects-repository/). This PR can merge alone. Nothing calls the new code until PR 3.

How to review this — altitude, what's in scope, what's deliberately unsettled

How to review this. This implements an approved spec — the approach and the numbered
decisions in its DECISIONS.md are already signed off by a human, so please review the
code against that direction, not the direction itself. The canonical set is retained
at specs/issues/<ISSUE-ID>/ on main; Linear links to it and the original merged spec
PR, which keeps review history. Follow-up amendment PRs explain later direction changes.
Current architecture docs remain the authority for shipped behavior (BP-037).

Most valuable here: correctness on the second path (the legacy shape, the null
boundary, the concurrent case, the cancel path), anything deriving an auth or routing
decision from caller-controllable input, and a behaviour the tests assert around
rather than on.

Already settled upstream: the approach and every decision in the spec's DECISIONS.md
(human-approved — if one is wrong, say so as a spec finding and it gets folded back; don't
re-argue it inline), and the conventions in docs/contributing/best-practices.md.

Engineering calls
  • baseRef is optional on a repository answer. The spec shows { kind: "repo", repo, baseRef }. A Workforce source cannot know the remote's default branch, and BR-17 needs a fresh read. So if baseRef is missing, the host uses the default branch. If wrong: a caller must give a base, and the default-branch read moves to the caller.
  • Kept files go on the answer: files: { collection, collectionId }. A collection ref comes from the context, and the host is built at boot with no context. If wrong: the answer shape changes before PR 4 uses it.
  • projectId and the project/ directory names stay as the spec pins them. The workspace layer treats projectId only as a key prefix. It does not know about Workforce. The guardrail "never says project" applies to the concept, not to these two pinned names.
  • exec.ts is copied, not moved, in this PR. The plan says the git run() moves here. Harness-manager is out of scope until PR 3, so PR 3 removes its copy.
  • A fixed sourceRepo path is not a remote. The host refuses bare paths. PR 3 must give it as a file:// URL with "file" allowed, and it gets clone semantics (branches go in the host's clone, not in sourceRepo). PR 3 must keep BR-22 ("unchanged behaviour") with this in mind.
  • One allowlist entry is one host (over https or ssh). "file" turns on file://. No entry turns on http or git://.
  • A credential on a remote is refused by the host too, as BR-6 does for the project row. Every message shows the remote with userinfo removed.
  • Place names: segments may not be empty, contain separators, or start with .. So no place can use the name .clones.
  • Changeset is minor, as PLAN S12 says. The change only adds things, and .changeset/README.md would allow patch.
Everything else — verification and files

Checks

Check What it proves Where
V1 (BR-25, BR-30) A mount scoped to a lists with "a/" at the source, never reads, writes or deletes a b/ or ab/ key, and deletes only what it hydrated. A bad scope is refused packages/workspace/test/scoped-mount.spec.ts
V2 (BR-10–12, 16–18, 21) Refusals before any git process: file:// not listed, ext::, ssh://-o…, scp git@-o…:, a value with a leading -, a host or scheme not listed, a bare path, a credential (not printed). GIT_ALLOW_PROTOCOL = the listed schemes. -- before every remote. One clone when two first runs start at once. A renamed default branch is followed. A retry and a lost checkout do no fetch. Another branch or another remote is refused and the checkout is kept packages/workspace/test/local-host-repo.spec.ts, test/remotes.spec.ts
V3 (BR-20, 23, 24, 26) The first run starts with an empty workspace/. A write is in <projectId>/… after save. The next run sees it. A delete goes through. Another project's run sees nothing. A lost place is filled again. Two runs that edit one file get a conflict, not an overwrite packages/workspace/test/local-host-files.spec.ts

Repository tests use real bare git repos over file://. Every git process is counted through vi.mock of src/exec.

Red before green. S2: 15 of 16 new tests failed before the change. S3: all 40 host tests failed against a stub that threw "not implemented". The review fixes (same place provisioned twice at once; bad projectId refused before anything is made) failed against the previous host.

Negative controls (I broke the property, then restored it):

  • V1: list with no scope → only "lists at the source" fails (1). Scope with no / and no re-check → ab/ leaks, 2 fail. Scope not used on writes and deletes → 5 fail.
  • V2: a git process before the remote check → all 9 refusal tests fail. Listed-host check off → only "host not listed" fails. file gate off → only "file:// not listed" fails. GIT_ALLOW_PROTOCOL not limited → only "limits transports" fails. No -- → only "puts --" fails. No clone lock → only "one clone at once" fails. Default branch fixed to main → only "renamed default branch" fails. Retry fetches → only "retry never fetches" fails. Repository identity check off → only "another remote" fails.
  • V3: save does nothing (no-sync-back) → 7 fail. Mount not scoped → 8 fail. Old handle used after the place is lost → only "lost place" fails. First run seeded → 5 fail. project/ put inside checkout/ → only the git status test fails.

In each case all other tests stayed green.

Runs on the pushed head: pnpm --filter @flow-state-dev/workspace test → 8 files, 149 tests pass. pnpm --filter @flow-state-dev/workspace typecheck passes. The tests also typecheck with tsc. Dependents: pnpm --filter @flow-state-dev/tools typecheck and pnpm --filter @flow-state-dev/claude-code typecheck pass, and tools test passes (470).

Files

  • src/run-source.ts (new) — S1 types.
  • src/types.ts, src/projection.ts — Mount.scope and the scoped list, read, write, delete and claim.
  • src/remotes.ts (new) — allowlist, clone key, redaction.
  • src/exec.ts (new) — run() with a timeout and env.
  • src/local-host.ts (new) — localWorkspaceHost, WorkspaceRefusedError.
  • src/index.ts — exports.
  • README.md — "Scoping a mount to one key prefix" and "Workspace hosts and run sources" (DOCS.md workspace section), plus API rows.
  • .changeset/workspace-host-and-scoped-mount.md — minor.
  • test/* — new specs, and the fake collection now filters list(prefix) like the engine does.

🤖 Generated with Claude Code

https://claude.ai/code/session_01P9UuEKLJUWaKiSrYWCJbt5


Generated by Claude Code


Note

High Risk
Introduces git remote parsing, child-process execution, and tenant isolation via scoped collection access—security- and data-integrity sensitive paths with deliberate tradeoffs (e.g. rebuilding unsaved kept files after restart).

Overview
Adds the shared @flow-state-dev/workspace layer for FIX-1762: a local workspace host that turns a run source answer into an on-disk workspace, plus scoped mounts so multi-tenant file collections only hydrate and flush one key prefix.

Scoped projection. Mount gains optional scope. Hydrate/flush/list/read/write/delete and claims all use keys under scope/…, with collection.list("scope/") at the source so other owners’ rows are never read. Invalid scopes are rejected via assertScope.

Run source & host. New types describe repo runs (optional baseRef, optional kept files via projectId + files), files-only runs, or explicit refusals. localWorkspaceHost({ root, remotes, source }) implements provision · save · release (and no-op checkpoint/restore). Repo runs get shared bare clones under .clones/, a per-run branch in checkout/, and kept files in project/ outside git; files-only runs use workspace/ as cwd. Remotes are validated in remotes.ts before any git runs, with allowlisted hosts/schemes, credential redaction, and WorkspaceRefusedError on failure. Retries reuse existing checkouts without fetch/reset; lost directories rebuild kept files from the collection.

Docs, exports, a minor changeset, and broad tests (scoped mount, remotes, files-only host, real-git repo host with process mocking) ship with the implementation. Nothing in-repo calls the host yet—that wiring is later PRs.

Reviewed by Cursor Bugbot for commit 72c01f8. Configure here.

claude added 3 commits October 4, 2026 21:13
…IX-1762)

A scoped mount lists its collection with the scope as a separator-bounded
prefix, strips the scope inside the place, and keys every read, write,
delete and claim back under it. Unscoped mounts are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P9UuEKLJUWaKiSrYWCJbt5
Adds the RunSource type (repo, files or a refusal, from the block
context alone) and localWorkspaceHost: provision, save and release over a
host directory, with checkpoint and restore declared as no-ops for the
next slice. A remote is judged against the operator's allowlist before
any git process starts; git runs with -- before the remote and
GIT_ALLOW_PROTOCOL limited to the listed schemes. One bare clone per
remote, made under a per-clone queue and moved into place whole; a new
branch is cut after a fetch and a fresh read of the default branch, and
an existing checkout is handed back without a fetch. Kept files are
hydrated into project/ beside the checkout, or workspace/ when there is
no repository, through a scoped mount, and saved back by flush.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P9UuEKLJUWaKiSrYWCJbt5
…side the clone queue (FIX-1762)

A bad projectId is refused before any checkout or git process exists, two
provisions of one place at once share one checkout instead of the second
failing in worktree add, and the clone identity check compares real paths.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P9UuEKLJUWaKiSrYWCJbt5
@vercel

vercel Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
flow-state-dev-docs Ignored Ignored Oct 4, 2026 9:44pm UTC
flow-state-dev-kitchen-sink Ignored Ignored Oct 4, 2026 9:44pm UTC
flow-state-dev-ui Ignored Ignored Preview Oct 4, 2026 9:44pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T21:34:56.889908Z 72c01f8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@linear-code

linear-code Bot commented Oct 4, 2026

Copy link
Copy Markdown

FIX-1762

@cursor

cursor Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: b2f1e1e2-d8a9-49c2-b777-f4f8663dc056)

jhoffner commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator Author

Second look + architecture pass (read-only, no edits)

Reviewed packages/workspace at 72c01f88 against the spec direction. The approach holds (scoped mount filtering at the collection, remote judged before git, shared bare clone + worktree). I found no blocking bug. Below is what I'd change while the code is still unused (nothing calls it until PR 3, so reshaping is free now and expensive after).

Worth doing in this PR (cheap now, costly after PR 3/4 build on it)

  1. Make the illegal RepoRunSource state unrepresentable. projectId? and files? must be both-or-neither, enforced by a runtime throw in provision (local-host.ts ~L396-402). Model it as a type instead: RepoRunSource = { kind:"repo"; repo; baseRef?; kept?: { projectId; files } }, or a union of two shapes. That deletes the runtime check and the test for it, and PR 3's RunSource implementations can't build a half-answer. This is the one change I'd make before anything depends on the shape. If the spec pins the flat names, note it as an engineering call and keep the flat fields — but I'd raise it.
  2. WorkspaceHost.source / LocalWorkspaceHostOptions.source is dead weight in the host. The host never reads it. It is "kept on the host for its callers to ask" (local-host.ts ~L96, L119). That makes the host a bag that carries a callback for someone else, and it forces the host to be constructed with something it doesn't use. Callers (harness-manager) already hold their own RunSource. Dropping it narrows the host to provision · save · release. If the spec requires the property, ignore this.
  3. checkpoint / restore are no-op methods on the public interface. They're declared "for a later slice". An interface method that silently does nothing is a trap: a caller that calls restore after a lost machine believes work came back. At minimum make them throw not implemented/be absent until slice 2 adds behaviour (the seam is one added method then). I'd rather remove them.

Real, if narrow, behaviours to decide on

  1. A branch name reused across places in one clone reuses another run's branch. In provisionCheckout, !made.fresh && hasBranch(clone, branch) runs worktree add checkout branch. The clone is shared across every run of a remote. If two runs (different place) are ever given the same branch, the second silently adopts the first's branch, or git fails with a worktree-already-checked-out error that surfaces as an opaque error, not a WorkspaceRefusedError. Either namespace the branch by place, or document that the caller owns uniqueness and map git's "already checked out" failure to a stable refusal reason. A test with two places + one branch name would pin it.
  2. Rebuild-on-restart wipes project/ even when the checkout was handed back (your own flagged weakest call, provisionFiles). The coupling that worries me: a retry after a crash gets the checkout back intact (work preserved) while project/ beside it is cleared and refilled. Those are two halves of one run and they now disagree about durability. Fine for slice 1, but the README's "Existing work is never discarded" claim (header of local-host.ts) is only true for the checkout. Soften the header line so it doesn't promise more than provisionFiles does.
  3. live map is only evicted by release. A caller that provisions and never releases (crash path, cancelled run) leaks a Projection per place in a long-lived process. Not urgent, but worth a note on release ("callers must release in a finally").

Architecture (refactor-while-here opportunities)

  1. exec.ts duplication. The PR copies run() and says PR 3 removes harness-manager's copy. The two have already diverged (harness-manager's has signal, a different maxBuffer default, extra timeout constants). Make sure PR 3 deletes the harness-manager one and re-exports/imports this one, and fold signal in then. Otherwise this becomes two permanent subtly different run()s. Please make that a checklist line in PR 3's description.
  2. placeDir validation vs assertScope. Two near-identical "plain segment" validators (placeDir in local-host.ts and assertScope in projection.ts) with slightly different rules (placeDir rejects leading .; assertScope rejects ./../backslash but allows .foo and NUL). Not a bug today, but a single assertPlainSegments in one leaf module is the BP-019/BP-034 shape and avoids drift. Low priority; fine to leave as a follow-up.
  3. local-host.ts at 468 lines mixes three jobs: clone/worktree git mechanics, the place layout, and kept-file projection lifecycle. The git half (refresh, ensureClone, hasBranch, provisionCheckout) has no dependency on projections. Splitting it into a git-clones.ts module would give PR 3/4 a smaller thing to read and let the git logic be tested without the files half. Only worth it if you're already touching this; don't hold the PR for it.

Not recommended

  • No simpler alternative to the bare-clone + worktree design: a per-run full clone would be the leaner code but loses the shared fetch and the "one clone for two simultaneous first runs" property V2 tests.
  • remotes.ts parsing is thorough. I'd leave it. (One nit: cloneKeyFor is case-sensitive on the path, so Org/Repo and org/repo on github get two clones. Harmless, just wasteful.)

Priority for the implementing agent: 1, 3, 4 (shape and contract, cheapest now), then 5's wording and 7 as a PR 3 note. The rest can wait.


Generated by Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify / architecture read

Verdict: The shape matches FIX-1762 PR 1 (S1 run source + S2 scoped mount + S3 local host) on purpose — not accidental scope creep. Scoped Mount.scope is a hard dependency for kept files under projectId; splitting host from scope would ship a host that cannot do multi-tenant project files yet. A ~1.7k-line PR is still a large review surface, but the alternative (types-only PR 1) would delay the only consumer until PR 3 without much payoff.

Could this have been simpler? A few paths I considered:

Alternative Trade-off
Third-party git wrapper (simple-git, etc.) Repo consistently uses execFile + explicit args; allowlist/GIT_ALLOW_PROTOCOL/-- hardening still needs custom parsing. Not a win here.
Smaller PR 1 (scope only, host later) Matches PLAN only if you reinterpret the stack; PLAN pins S1–S3 together in PR 1. Host without scope cannot hydrate project/ / workspace/ correctly.
Drop checkpoint/restore from WorkspaceHost until slice 2 Smaller public API; keeping named no-ops matches EVOLUTION.md and documents the seam — reasonable product call either way.
Move git subprocess + worktree logic into harness-manager only Would duplicate what harness already has; D2 is explicitly “git only through workspace host.” This PR is the dedup direction, not extra complexity.

What looks appropriately complex: remotes.ts as pure validation before spawn; exec.ts as a single mockable spawn site; serially() per clone key; hand-back vs cut-branch policy; scoped rowsOf() with prefix list() (BP-033). Tests (spawn counting, scoped listCalls, git fixtures) match the security/retry claims.

Follow-ups worth considering (non-blocking):

  1. provisionFiles concurrency — clone work uses serially(); kept-files provisioning does not. Two overlapping provision() calls for the same filesDir can both miss the cache and race on rmSync/hydrate unless callers guarantee single-flight per place.
  2. handBack identity — inline realpathSync + --git-common-dir parallels identityFromCommonDir in harness-manager. When S4 wires harness to this host, share one definition (tiny shared helper or export from workspace) so the two paths cannot drift.
  3. hasBranch bare catch — any git failure reads as “no branch” and may push down the refresh/cut path; narrowing to expected exit codes would avoid masking transient errors.
  4. RepoRunSource shape — projectId / files validated together at runtime; a discriminated union (checkoutOnly vs withProjectFiles) would shrink provision branches when the API stabilizes.
  5. Performance (later) — full refresh() fetch on each new branch cut and sync readdirSync walks in createHostPlace are acceptable for slice 1; worth revisiting if DevForce runs get large trees or hot remotes.

Ran pnpm --filter @flow-state-dev/workspace test on this branch: 147/149 passed; two local-host-repo cases timed out in this environment (likely flake under parallel git), not assertion failures.

Direction looks right; approving with the notes above as optional tighten-ups before or during harness-manager integration (PR 3).

Open in Web View Automation 

Sent by Cursor Automation: Review For Best Approach

Comment thread packages/workspace/src/local-host.ts Resolved
Comment thread packages/workspace/src/local-host.ts Resolved
return { remote: remote.url, clone, branch, created: false };
}

const defaultBranch = made.fresh ? made.defaultBranch! : await refresh(clone, remote);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance note (deferrable): Every new branch cut on an existing clone calls refresh(), which ls-remotes and then fetches all heads. That matches BR-17 (follow renamed default branch) but is the main latency cost under burst provisioning. If this shows up in practice, options are caching default branch with a TTL, or fetching only baseRef when the caller pins it — without weakening the rename behavior for the default case.

/** The key prefix of the kept files. Required together with `files`. */
projectId?: string;
/** The collection of kept files. Required together with `projectId`. */
files?: RunFiles;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type simplification (maybe later): projectId and files are optional independently but provision rejects unless both are set or both omitted. A discriminated union on kind: "repo" (e.g. files: undefined vs { projectId, files }) would make invalid states unrepresentable and drop the runtime pairing Error in local-host.ts. Worth it once Workforce’s projectWorkspace shape is frozen.

const readable = identity.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^[-.]+/, "").slice(0, 80);
const hash = createHash("sha256").update(identity).digest("hex").slice(0, 12);
return `${readable}-${hash}`;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach check: Custom URL/scp parsing instead of a git library is the right fit for this repo — you need refusal before spawn and GIT_ALLOW_PROTOCOL alignment. I would not swap this for simple-git.

Nit: exporting checkRemote only from the package root (or a workspace/security subpath) could help integration tests in PR 3 assert the same rules without reaching into ./remotes — only if you want that coupling explicit.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Snob — already tight. No POC.

Read packages/workspace/src/local-host.ts, remotes.ts, run-source.ts, exec.ts, the scope changes in projection.ts, and the new specs (local-host-repo, local-host-files, scoped-mount, remotes) plus git-fixtures.ts.

A rewrite would not shrink this contract:

  • rowsOf keeps two strips. An unscoped mount still strips the mount prefix off an unfiltered list(). A scoped mount strips the pattern prefix, lists "<scope>/", and checks the separator again. One loop is the same length.
  • placeDir and assertScope are different checks. A place segment may not start with . or contain NUL. A scope is several /-separated segments and rejects . / ... A shared validator with those switches is longer.
  • serially chains one clone's git. provisionFiles replaces one directory's projection. Same "drop this promise if it is still current" tail, different job. One queue helper is longer.
  • entryKey is already the single seam for claim, read, write, and delete.
  • checkpoint / restore as named no-ops, and source kept on the host, are the slice-2 seam and the host.source(ctx) call the spec already pins. Dropping them changes what PR 3 builds on.
  • Copying exec.ts instead of moving harness-manager's run() is the split this PR recorded for PR 3. The two copies already differ (signal, buffer).
  • The refusal table, the clone-key specs, and the "no git process" specs pin different layers. The file headers restate the README and are not a smaller host.

Head 72c01f88.

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 72c01f8842

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/workspace/src/remotes.ts Resolved
Comment thread packages/workspace/src/local-host.ts Resolved
Comment thread packages/workspace/src/local-host.ts Resolved
Comment thread packages/workspace/src/remotes.ts Resolved
Comment thread packages/workspace/src/remotes.ts Resolved
claude added 2 commits October 4, 2026 21:37
…rmed file escapes (FIX-1762)

- redactRemote strips userinfo through the last @ before the path, so a
  credential holding an @ is never printed in a refusal.
- A non-default port is part of the clone identity; :22 (ssh) and :443
  (https) stay the same clone as no port.
- A file:// path with a malformed %-escape is an invalid-remote refusal
  rather than a thrown URIError.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P9UuEKLJUWaKiSrYWCJbt5
…ross hosts (FIX-1762)

- A place is marked while `git worktree add` runs. A marked checkout whose
  tree only has tracked files missing (or no .git) is a killed add and is
  rebuilt; a marked tree with any other change is refused and kept. Ported
  from harness-manager's looksHalfBuilt / everyChangeIsADeletion.
- Provisioning a place and working on a clone take a lock file on disk
  (src/lock.ts, ported from harness-manager's checkout lease), so two hosts
  or processes sharing a root wait instead of racing `worktree add -b`. The
  holder refreshes the lock; one left by a dead process is taken once stale.
  The in-process queue stays in front of it. Lock and marker names start with
  "." so no place segment can name over them. The place lock also serialises
  the kept-files hydrate.
- hasBranch reads only git's "no such ref" exit as false and raises any
  other failure.
- Real-git host tests get a 30s per-test timeout for monorepo-wide runs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P9UuEKLJUWaKiSrYWCJbt5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants